const EventEmitter = require('events'); //引入事件模块
const myEmitter = new EventEmitter.EventEmitter();//创建EventEmitter对象用于监听
//注册seen事件用于监视，有人来了就报告
myEmitter.on('seen', () => {
  console.log('报告，有人来了');
});
myEmitter.emit('seen'); //触发（发射）seen事件进行报告

